﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GuildStock.Models;

namespace GuildStock.Services
{
  /// <summary>
  /// Guild comparer.
  /// </summary>
  public class GuildComparer : IEqualityComparer<Guild>
  {
    public bool Equals(Guild x, Guild y)
    {
      if (x == null || y == null)
      {
        return false;
      }

      return x.GuildName == y.GuildName && x.RealmName == y.RealmName;
    }

    public int GetHashCode(Guild obj)
    {
      return obj == null ? 0 : (obj.GuildName + obj.RealmName).GetHashCode();
    }
  }
}